/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2023-12-30
 * Time: 16:18
 */
import java.util.Scanner;
abstract class Vehicle{
    String strName;
    abstract Boolean isOverload();
}

class Car extends Vehicle {
    int nPerson = 0;

//编写构造方法
    /********************begin********************/
    Car(String strName) {
        this.strName = strName;
    }


    /*********************end*********************/

    void GetOn(int n) {
        nPerson += n;
    }

    void GetOff(int n) {
        nPerson = nPerson >= n ? nPerson - n : 0;
    }

    Boolean isOverload() {
        return nPerson > 10;
    }

    public String toString() {
        return strName + " loads " + nPerson + " persons," + (isOverload() ? "overloaded." : "not overloaded.");
    }
}

class Trunk extends Vehicle{
    double dTon=0;

//编写构造方法
    /********************begin********************/

    Trunk(String strName) {
        this.strName = strName;
    }

    /*********************end*********************/

    void upLoad(double d){
        dTon+=d;
    }
    void unLoad(double d){
        dTon=dTon>=d?dTon-d:0;
    }
    Boolean isOverload(){
        return dTon > 15.0;
    }
    public String toString(){
        return strName+" loads "+dTon+" goods,"+(isOverload()?"overloaded.":"not overloaded.");
    }
}

class Check{
    void Up(Vehicle v,double n){

/********************begin********************/
  if(n < 0) {
      return;
  }
   if(v instanceof Car) {
       ((Car)v).GetOn((int)n);
   }
   if(v instanceof  Trunk) {
       ((Trunk)v).upLoad(n);
   }
/*********************end*********************/

    }

    void Down(Vehicle v,double n){
/********************begin********************/
        if(n < 0) {
            return;
        }
        if(v instanceof Car) {
            ((Car)v).GetOff((int)n);
        }
        if(v instanceof  Trunk) {
            ((Trunk)v).unLoad(n);
        }

/**********************end********************/
    }

    void Info(Vehicle v){
        System.out.println(v);
    }
}


public class Main {
    public static void main(String[] args) {
        Vehicle car=new Car("Car");
        Vehicle trunk=new Trunk("Trunk");
        Check ck=new Check();
        Scanner sc=new Scanner(System.in);

        String strName,strP;

        for(int i=0;i<4;i++){
            strName=sc.next();
            if(strName.equals("Car")){
                strP=sc.next();
                if(strP.equals("Up"))
                    ck.Up(car,sc.nextDouble());
                else if(strP.equals("Down"))
                    ck.Down(car,sc.nextDouble());
            }
            else if(strName.equals("Trunk")){
                strP=sc.next();
                if(strP.equals("Up"))
                    ck.Up(trunk,sc.nextDouble());
                else if(strP.equals("Down"))
                    ck.Down(trunk,sc.nextDouble());
            }

        }

        ck.Info(car);
        ck.Info(trunk);


    }
}